#ifndef MAPWIDGET_H
#define MAPWIDGET_H

#include <QGraphicsView>
#include <QLabel>
#include <QMouseEvent>
#include <QSlider>

class MapWidget : public QGraphicsView
{
    Q_OBJECT
public:
    MapWidget();
    void readMap();                                             //读取地图信息
    QPointF mapToMap(QPointF);                                  //用于实现场景坐标与地图坐标之间的映射，以获得某点的经纬度坐标
public slots:
    void slotZoom(int);
    // QWidget interface
protected:
    void mouseMoveEvent(QMouseEvent *event);
    void drawBackground(QPainter *painter, const QRectF &rect); //完成地图显示的功能
    void wheelEvent(QWheelEvent *event);
private:
    QPixmap map;
    qreal zoom;
    QLabel *viewCoord;
    QLabel *sceneCoord;
    QLabel *mapCoord;
    QSlider *slider;
    double x1,y1;
    double x2,y2;
    int currentValue = 50;
};

#endif // MAPWIDGET_H
